using System;
using System.IO;
using System.Text.RegularExpressions;
using System.Web;
namespace HKB.Common
{
	internal class MyModule : IHttpModule
	{
		public void Init(HttpApplication context)
		{
			context.BeginRequest += new System.EventHandler(this.MyRequest);
		}
		public void Dispose()
		{
		}
		protected void MyRequest(object sender, System.EventArgs e)
		{
			HttpApplication httpApplication = (HttpApplication)sender;
			HttpContext context = httpApplication.Context;
			HttpResponse response = context.Response;
			string text = context.Request.Path;
			string fileName = System.IO.Path.GetFileName(text);
			string text2;
			if (fileName != "")
			{
				text2 = text.Replace(fileName, "");
			}
			else
			{
				text2 = text;
			}
			Regex regex = new Regex("([A-Za-z1-9]{1,})\\-(\\d+).aspx");
			Match match = regex.Match(fileName);
			bool flag = false;
			if (match.Success)
			{
				flag = true;
				string text3 = match.Groups[1].Value.ToLower();
				string text4 = text3;
				if (text4 != null)
				{
					if (text4 == "showproduct")
					{
						text = string.Concat(new string[]
						{
							"~",
							text2,
							match.Groups[1].Value,
							".aspx?productid=",
							match.Groups[2].Value
						});
						goto IL_23F;
					}
					if (text4 == "shopindex")
					{
						text = string.Concat(new string[]
						{
							"~",
							text2,
							match.Groups[1].Value,
							".aspx?shopid=",
							match.Groups[2].Value
						});
						goto IL_23F;
					}
					if (text4 == "productlist")
					{
						text = string.Concat(new string[]
						{
							"~",
							text2,
							match.Groups[1].Value,
							".aspx?classid=",
							match.Groups[2].Value
						});
						goto IL_23F;
					}
				}
				text = string.Concat(new string[]
				{
					"~",
					text2,
					match.Groups[1].Value,
					".aspx?id=",
					match.Groups[2].Value
				});
				IL_23F:
				context.RewritePath(text);
			}
			if (!flag)
			{
			}
		}
	}
}
